import re
import time

import requests

pattern = re.compile(r'<title>(?P<foo>.*?)</title>')
urls = [
    'https://www.python.org/',
    'https://www.taobao.com/',
    'https://pypi.org/',
    'https://www.git-scm.com/',
    'https://www.jd.com/',
    'https://opendata.sz.gov.cn/',
    'https://www.datacamp.com/'
]


def show_title(url):
    time.sleep(1)
    resp = requests.get(url)
    html_code = resp.text
    match = pattern.search(html_code)
    if match:
        print(match.group('foo'))


def main():
    for url in urls:
        show_title(url)


if __name__ == '__main__':
    main()
